#ifndef WDT_DEFINES_H
#define WDT_DEFINES_H
	
/* Includes -----------------------------------------------------*/
#include "gkt_types.h"
#include "gkt_board.h"
#include "gkt_defines.h"
#include "gkt_driver.h"

/* Global Variables ---------------------------------------------*/
/* Macro --------------------------------------------------------*/
#ifdef GKT_CONFIG_WDT_DEVNUMS
#define WDT_DEVNUMS	GKT_CONFIG_WDT_DEVNUMS
#else
#define WDT_DEVNUMS	GKT_WDT_MAXNUMS
#endif
#if !WDT_DEVNUMS
#error "wdt device number is ZERO!"
#endif

typedef struct wdt_attr {
	gkt_device_base_attr_s	base_attr;
} wdt_attr_s;

#define WDT_ATTR(dev_id)	\
	{	\
		.base_attr = GKT_DEVICE_BASE_ATTR(WDT, dev_id),	\
	}

#define WDT_ATTRS_1	WDT_ATTR(0)
#define WDT_ATTRS_2	WDT_ATTRS_1, WDT_ATTR(1)


#define __WDT_ATTRS_DEFINE(dev_nums)	WDT_ATTRS_##dev_nums
#define _WDT_ATTRS_DEFINE(dev_nums)	__WDT_ATTRS_DEFINE(dev_nums)

#define WDT_ATTRS_DEFINE	\
	const wdt_attr_s gc_wdt_attrs[WDT_DEVNUMS] = {	\
		_WDT_ATTRS_DEFINE(WDT_DEVNUMS)	\
	}


/* declare wdt attrs */	
extern const wdt_attr_s gc_wdt_attrs[];

#define WDT_BASEADDR(dev_id)	gc_wdt_attrs[dev_id].base_attr.base_addr

extern __RETMEM_USR uint32_t s_wdte_busy_bits;

/*
 * @brief vpwm device instance
 */
#define WDT_STATE_CONFIG	gkt_bit(0)		/* device has been configed */
#define WDT_STATE_WORKING	gkt_bit(1)
#define WDT_STATE_FEED		gkt_bit(2)		

typedef struct wdt_instance {
	volatile uint32_t	state;
	/* other members ... */
}wdt_instance_s;

typedef struct wdt {
	int	init_ok;
	wdt_instance_s		instances[WDT_DEVNUMS];
} wdt_s;

/* Extern Functions ---------------------------------------------*/
/* Static Functions ---------------------------------------------*/
/* Functions ----------------------------------------------------*/

#endif	/* WDT_DEFINES_H */

